package mk.company.fin.utils;

import javax.swing.InputVerifier;
import javax.swing.JComponent;
import javax.swing.JTextField;

public class NumberInputVerifier extends InputVerifier {

	@Override
	public boolean verify(JComponent input) {
		if (input instanceof JTextField){
			try {
				Integer.parseInt(((JTextField)input).getText());
				
				return true;
			}
			catch (Exception e){
				((JTextField)input).setText("");
				return false;
			}
		}
		return false;
	}

}
